package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.BuyOrderBean;
import com.project.bean.BuyOrderInfoBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * 采购明细
 */
@Mapper
public interface IBuyOrderInfoMapper extends BaseMapper<BuyOrderInfoBean> {

    /**
     * 动态分页查询采购订单
     * @param pageNO 页码
     * @param vendorName 供应商名字
     * @param startDate 起始日期
     * @param endDate 结束日期
     * @return 订单分页对象
     */
    IPage<BuyOrderBean> findByItem(Page pageNO, @Param("vendorName") String vendorName,
                                  @Param("startDate") LocalDate startDate,
                                  @Param("endDate") LocalDate endDate);

    /**
     * 根据采购id，查询采购基本信息，
     * 同时查询该采购明细信息，在采购明细信息中，需要查询商品名称和品牌
     * @param buyOrderId 采购订单ID
     * @return 采购订单对象
     */
    BuyOrderBean findByOrderId(Integer buyOrderId);


}
